////////////////////////////////////////////////////////////////////////////////
// Filename: modelclass.h
////////////////////////////////////////////////////////////////////////////////
#ifndef _MODELCLASS_H_
#define _MODELCLASS_H_


//////////////
// INCLUDES //
//////////////
#include <windows.h>
#include <xnamath.h>

#include <string>

#include "CDirect3D.h"
#include "Texture.h"
#include <vector>
#include "BasicEffect.h"

class Mesh;
class Bone;
struct aiScene;
class TiXmlElement;
class ShadowMap;

class Model3D
{
public:
	Model3D();
	Model3D(const Model3D&);
	Model3D operator=(Model3D const&);
	~Model3D();

	void SetShader(BasicEffect* pShader);
	void Initialize(TiXmlElement* pModel3DElement);
	void Load3DModelFile(std::string pFile);
	void Dispose();
	void Render(const XMFLOAT4X4 &worldMatrix, const XMFLOAT4X4 &viewMatrix, const XMFLOAT4X4 &projectionMatrix);
	//void ShadowRender(ShadowMap* pShadowMap, const XMFLOAT4X4 &worldMatrix);

	Texture* GetTexture(unsigned int pMaterialIndex);

	Mesh* GetMeshByIndex(int pIndex);
	int GetMeshesCount();
	Mesh* GetMeshByName(std::string pName);
	Bone* GetBoneByMeshIndex(int pIndex);
	Bone* GetBoneByName(std::string pName);

	std::string GetPath();
	int GetId();
private:
	const aiScene* mScene;
	std::string mPath;
	int mId;

	std::string mDirectory;

	int mMeshesCount;
	Mesh** mMeshes;
	Bone** mBones;
	BasicEffect* mShader;

	Mesh* mMainMesh;
};

#endif